import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';

import './assets/style/main.scss';

/* store */
import store from './store/index.js';
import router from './router/index.js';
import './http/index.js';

// Vue粒子特效
import VueParticles from 'vue-particles'
Vue.use(VueParticles)

Vue.config.productionTip = false;
// 修改 el-dialog 默认点击遮照为不关闭
ElementUI.Dialog.props.closeOnClickModal.default = false;
Vue.use(ElementUI);

var rules_list=JSON.parse(window.sessionStorage.getItem("rules_list"));
//图片拼接

Vue.prototype.get_rules =function (name){
	if(!rules_list){
		 rules_list=JSON.parse(window.sessionStorage.getItem("rules_list"));
	}
	
	if(rules_list.indexOf(name) > -1){
		return true;
	}else{
		return false;
	}
};

import {
	numberToCurrencyNo,
	dateFilter,
	keepTwoNum
} from './util/index.js'
Vue.filter('numberToCurrencyNo', numberToCurrencyNo);
Vue.filter('dateFilter', dateFilter);
Vue.filter('keepTwoNum', keepTwoNum); 

// 自定义指令，控制权限按钮的显示或者隐藏
Vue.directive('has', {
	inserted: function(el, binding, vnode) {
		let btnPermissionsId = binding.value; // 当前权限按钮的ID
		if (!store.state.btnPermissions.includes(btnPermissionsId)) {
			el.parentNode.removeChild(el);
		}
	}
})


new Vue({
	router,
	store,
	render: h => h(App),
}).$mount('#app')
